//package com.zdw.template.config.datasourceproxy;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import io.seata.rm.datasource.DataSourceProxy;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.env.Environment;
//import javax.sql.DataSource;
//
///**
// * seata分布式事务-数据源问题,使用手动代理数据源
// */
//@Configuration
//public class DataSourceConfig {
//
//    @Resource
//    private Environment env;
//
//    @Bean
//    public DataSource getDataSource() {
//        DruidDataSource dataSource = new DruidDataSource();
//        dataSource.setUrl(env.getProperty("spring.datasource.url"));
//        dataSource.setUsername(env.getProperty("spring.datasource.username"));
//        dataSource.setPassword(env.getProperty("spring.datasource.password"));
//        dataSource.setDriverClassName(env.getProperty("spring.datasource.driver-class-name"));
//        return dataSource;
//    }
//
//    @Primary
//    @Bean("dataSource")
//    public DataSourceProxy dataSource(DataSource druidDataSource) {
//        return new DataSourceProxy(druidDataSource);
//    }
//
//}
